*Replication File for "Voter Responses to Fiscal Austerity"

*Dear reader,

*If you have any questions about the dofile or the data, do not hesitate to contact me.

*Best regards, 

*Evelyne Hübscher, huebschere@ceu.edu



*Packages needed: 
*- coefplot
*- marginsplot
*- grc1leg





clear
set more off

***************************************************************
*The following lines of code include the models for figure 1-3*
***************************************************************



foreach country in Germany UK Spain Italy Portugal {

	use "`country'_Vignette.dta", clear

	
g vote_e2 = E2vote-1

replace eisced = . if eisced == 55

recode E2app (5=1) (4=2) (2=4) (1=5), gen(app_e2)


sum Q16
g leftright = Q16

sum Q1010
g income = Q1010-r(mean)

********************
*Model for Figure 2*
********************

regress vote_e2 ib3.E2Vignettes i.vote_gov age gender i.eisced leftright income [pweight=weighttoess]
estimates store `country'

*********************
* Model for Figure 3*
*********************
	
regress vote_e2 ib3.E2Vignettes##c.leftright ib3.E2Vignettes##c.income ib3.E2Vignettes##i.vote_gov age gender i.eisced [pweight=weighttoess]
estimates store `country'_interaction
margins, at(leftright=(0(1)10) E2Vignettes=(1 2))
marginsplot,  plot1opts(recast(line) lpattern(solid) lcolor(gray)) legend(position(6) size(vsmall)) ///
plot2opts(recast(line)lpattern(solid) lcolor(black)) ///	
ytitle("") yscale(range(0.2 1)) ylabel(0.2(.2)1, labsize(4.5)) ///
	xtitle(Left-Right, size(4.5)) xlabel(0(2)10, labsize(4.5)) ///
	title(`country', size(4.5)) ///
	legend(size(3.5)) ///
	saving(`country'_leftright.gph, replace)   ///
	ci1opts(recast(rline) lpattern(shortdash) lcolor(gray)) ci2opts(recast(rline) lpattern(shortdash) lcolor(black)) ///
	addplot(hist leftright if  e(sample),  fraction ///
	legend(order (3 "Tax increase" 4 "Cuts") size(3.5) rows(1))) ///
nodraw

**********************
* Barplots (Figure 1)*
**********************

g ftype = 1 if E2Vignettes == 3
replace ftype = 2 if E2Vignettes == 1
replace ftype = 3 if E2Vignettes == 2
label define ftype 1 "No action" 2 "Tax increases" 3 "Spending cuts"
label values ftype ftype

cibar vote_e2, over1(ftype) ///
barcolor(gs13 gs10 gs5) ///
graphopts(yscale(range(0 0.9)) ///
ytitle("") ylabel(0(.1)0.9, labsize(5.5)) ///
title(`country', size(6)) ///
legend (size(4.5)rows(1) pos(6)) ///
scheme(plotplain) saving(bar_vote_`country'.gph, replace)) ///
bargap(5) ciopts(lcolor(black) lwidth(medthin))  

cibar app_e2, over1(ftype) ///
barcolor(gs13 gs10 gs5) ///
graphopts(yscale(range(1 3)) ///
ytitle("") ylabel(1(0.5)3, labsize(6))  ///
title(`country', size(5.5)) ///
legend (size(4.5) rows(1) pos(6)) ///
scheme(plotplain) saving(bar_app_`country'.gph, replace)) ///
bargap(5) ciopts(lcolor(black) lwidth(medthin))  	
}

*****************************
*Barplot Combined (Figure 1)*
*****************************


grc1leg bar_vote_Germany.gph bar_vote_UK.gph bar_vote_Italy.gph bar_vote_Spain.gph bar_vote_Portugal.gph, ///
	row(1)  ///
	graphregion(fcolor(white)) 
graph display, xsize(9.0)	



*****************************
*Coefficient Plot (Figure 2)*
*****************************

	
coefplot Portugal || UK || Germany || Italy || Spain, bycoef byopts(iscale(1.25)) ///
	keep(1.E2Vignettes 2.E2Vignettes) ///
	coeflabel(2.E2Vignettes="Spending cuts", labsize(5)) ///
	ylabel(, labsize(3.5)) xlabel(,labsize(3.5)) xline(0, lpattern(dash)) ///
	scheme(plotplain) 


*************************************************************************************************
* Predicted probabilities to vote against government, depending on treatment/ideology (Figure 3)*
*************************************************************************************************

  
graph combine UK_leftright.gph ///
	Portugal_leftright.gph ///
	Germany_leftright.gph ///
	Italy_leftright.gph ///
	Spain_leftright.gph




